package com.ikas.ai.server.module.instance.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ikas.ai.server.module.instance.dorisDao.DorisWorkFlowInstanceDao;
import com.ikas.ai.server.module.instance.enums.WorkFlowInstanceStateEnum;
import com.ikas.ai.server.module.instance.model.DorisWorkFlowInstance;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author hu.bowei@ikasinfo.com
 * @date 2023-5-6 13:43:58
 */
@Service
public class DorisWorkFlowInstanceService extends ServiceImpl<DorisWorkFlowInstanceDao, DorisWorkFlowInstance> {

    /**
     * 运行中的工况
     *
     * @param machineNo
     * @return
     */
    public List<DorisWorkFlowInstance> getProcessingList(String machineNo) {
        LambdaQueryWrapper<DorisWorkFlowInstance> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DorisWorkFlowInstance::getState, WorkFlowInstanceStateEnum.PROCESSING.getCode());
        queryWrapper.eq(DorisWorkFlowInstance::getMachineNo, machineNo);
        return super.list(queryWrapper);
    }
}
